import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/restes.css'
import './assets/fontss/iconfont.css'
import axios from 'axios'

//配置根路径'
axios.defaults.baseURL = 'http://v.juhe.cn'
    //请求之前拦截
axios.interceptors.request.use(function(config) {
    token = sessionStorage.getItem('token');
    //设置请求头
    config.headers['token'] = token;
    //前端 得到 token 会把这个 token (存储到sessionStorage )  配置 请求头 里面 request.headers.token = token  
    return config;
}, function(error) {
    // Do something with request error  处理请求错误
    fail("请求失败,网络异常")
    return Promise.reject(error);
});
Vue.prototype.$http = axios
Vue.config.productionTip = false

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')